import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import myyfRouter from '../router/modules/myyf_Router'
import csRouter from '../router/modules/cs_Router'
import lgcRouter from '../router/modules/lgc_Router'
import tkfRouter from '../router/modules/tk_Router'
import wtRouter from '../router/modules/wt_Router'

Vue.use(VueRouter)
// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/',
    redirect: '/recommend',
    meta: {
      title: '推荐'
    },
    name: '/'
  },
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
  ...myyfRouter,
  ...csRouter,
  ...lgcRouter,
  ...tkfRouter,
  ...wtRouter
]

const router = new VueRouter({
  routes
})

export default router
